import Vue from 'vue'
import {fetch, put, post, del} from "./baseApi";

Vue.prototype.$fetch = fetch
Vue.prototype.$put = put
Vue.prototype.$post = post
Vue.prototype.$delete = del
export const getCateParamsList = (payload) => {
  return Vue.prototype.$fetch("categories", payload)
}
export const getParamsList = (payload) => {
  return Vue.prototype.$fetch("categories/" + payload.id + "/attributes", payload.sel)
}
export const addParams = (payload) => {
  return Vue.prototype.$post("categories/" + payload.id + "/attributes", payload.params)
}

export const getParamsById = (payload) => {
  return Vue.prototype.$fetch("categories/" + payload.id + "/attributes/" + payload.attr_id, payload.attr_sel)
}
export const updateParamsById = (payload) => {
  return Vue.prototype.$put("categories/" + payload.id + "/attributes/" + payload.attr_id, payload.attr_sel)
}
export const removeParamsById = (payload) => {
  return Vue.prototype.$delete("categories/" + payload.id + "/attributes/" + payload.attr_id)
}
export const editAddParams = (payload) => {
  return Vue.prototype.$put("categories/" + payload.id + "/attributes/" + payload.attr_id, payload.p)
}
